#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int MAXN = 1010;
const int mod = 1e9+7;

char s[MAXN];
int n,a[MAXN];
ll f[MAXN][10][10][2][2][2][2];
bool g[MAXN][10][10][2][2][2][2];

ll dfs(int cur,int las,int llas,bool ok,bool have0,bool p0,bool lim){
	if(cur == n+1) {if(ok) return 1;return 0;}
	if(g[cur][las][llas][ok][have0][p0][lim]) return f[cur][las][llas][ok][have0][p0][lim];
	ll tot = 0;
	for(int i = 0;i <= (lim ? a[cur] : 9);i++){
		tot = (tot + dfs(cur+1,i,las,ok | (i == las && !have0) | (i == llas && !p0),have0 && (i == 0),have0,lim && (i == a[cur]))) % mod;
	}
	g[cur][las][llas][ok][have0][p0][lim] = 1;
	return f[cur][las][llas][ok][have0][p0][lim] = tot;
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	ll ans = 0;
	scanf("%s",s+1); n = strlen(s+1); for(int i = 1;i <= n;i++) a[i] = s[i] - '0';
	a[n]--; for(int i = n;i >= 1;i--) if(a[i] < 0) a[i] += 10,a[i-1]--;else break;
	ans = dfs(1,0,0,0,1,1,1); memset(g,0,sizeof(g));
	scanf("%s",s+1); n = strlen(s+1); for(int i = 1;i <= n;i++) a[i] = s[i] - '0'; 
	ans = ((dfs(1,0,0,0,1,1,1) - ans) % mod + mod) % mod;
	printf("%lld\n",ans);
	return 0;
}

